package com.example.mapper.institutioncare.peoplemanagement;

import com.example.bean.institutioncare.peoplemanagement.*;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface PeoplemanagementMapper {
    List<Peoplemanagement> peoplemanagementList(PeoplemanagementDuoTiaoJian peoplemanagementDuoTiaoJian);
    int haoba(RuZhuGuanLiNum ruZhuGuanLiNum);
    @Select("select * from ruzhuguanli where noid =#{noid}")
    RuZhuGuanLiNum ruzhuguanliBean(String noid);
    @Update("update ruzhuguanli set jigou_id=#{jigouId},rzname=#{rzname},sex=#{sex}," +
            "shenfen=#{shenfen},chusheng=#{chusheng},minzu=#{minzu},zhengzhi=#{zhengzhi}," +
            "leibie=#{leibie},shenti=#{shenti},shangchuan=#{shangchuan},canji=#{canji},"+
            "phone=#{phone},contacts_name=#{contactsName},contacts_phone=#{contactsPhone},hunyin=#{hunyin},"+
            "zhuzhi=#{zhuzhi} where noid=#{noid}")
    int xiugai(RuZhuGuanLiNum ruZhuGuanLiNum);

    int shanchu(List<String>list);

    @Update("update ruzhuguanli set zhuxiao_time=#{zhuxiaoTime},yuanyin=#{yuanyin},is_delete=#{isDelete} where noid=#{noid}")
    int zhuxiao(ZhuXiao zhuXiao);

    @Select("select * from t_basicinformation")
    List<LiangGeCanShu>xialaList();

    @Select("select (select COUNT(*) FROM ruzhuguanli where shenti='自理（完全自理）')AS'zili_laoren',\n" +
            "(select COUNT(*) FROM ruzhuguanli where shenti='介助（半自理）')AS'banzili_laoren',\n" +
            "(select COUNT(*) FROM ruzhuguanli where shenti='介护（完全不能自理）')AS'shineng_laoren' \n" +
            "FROM ruzhuguanli LIMIT 1")
    BingZhuangTu bingzhuangtu();

    @Select("select (select COUNT(*) FROM ruzhuguanli where leibie='城市特困人员（三无）')AS'chengshitekun_renyuan',\n" +
            "(select COUNT(*) FROM ruzhuguanli where leibie='优抚老年人')AS'youfu_laonianren',\n" +
            "(select COUNT(*) FROM ruzhuguanli where leibie='低保老年人')AS'dibao_laonianren',\n" +
            "(select COUNT(*) FROM ruzhuguanli where leibie='计划生育特殊困难家庭老年人')AS'jihuashengyu_tekun',\n" +
            "(select COUNT(*) FROM ruzhuguanli where leibie='低收入老年人')AS'dishouru_laonianren',\n" +
            "(select COUNT(*) FROM ruzhuguanli where leibie='农村特困人员（五保）')AS'nongcuntekun_renyuan'\n" +
            "FROM ruzhuguanli LIMIT 1")
    ZhuZhuangTu zhuzhuangtu();

}
